home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / seek.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  776b  |  37 lines

  1. /* Seek.c   V1.0   93-03-15                        */
  2. /* ROM library: "dos.library/Seek", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club     */
  4.  
  5. #include <dos/dos.h>
  6.  
  7. #include <clib/dos_protos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. UBYTE *version = "$VER: Seek 1.0";
  12.  
  13. int main( int argc, char *argv[] );
  14. int main( int argc, char *argv[] )
  15. {
  16.   BPTR my_file;
  17.   int old_pos;
  18.  
  19.  
  20.   /* Open an old (already existing) file: */
  21.   my_file = Open( "RAM:Score.dat", MODE_OLDFILE );
  22.   if( !my_file )
  23.     exit( 20 );
  24.  
  25.   /* Move 3 bytes forward from the beginning of the file: */
  26.   old_pos = Seek( my_file, 3, OFFSET_BEGINNING );
  27.  
  28.   printf( "Old position: %d\n", old_pos );
  29.   printf( "New position: 3\n" );
  30.  
  31.   /* Close the file: */
  32.   Close( my_file );
  33.  
  34.   exit( 0 );
  35. }
  36.  
  37.